package cn.wolfcode.luowowo.acticle.domain;

import cn.wolfcode.luowowo.common.domain.BaseDomain;
import cn.wolfcode.luowowo.member.domain.UserInfo;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * 问答
 */
@Getter
@Setter
public class QuestionAndAnswer extends BaseDomain  {

    public static final int STATE_WAITING = 0;  //待发布(审核中)
    public static final int STATE_ANSWERED = 1;  //已回答
    public static final int STATE_UNANSWERED = 2;  //未回答

    private Long id;
    private UserInfo author;//作者
    private Destination dest;  //目的地
    private String title;  //标题
    private String summary;//概要
    private String coverUrl; //封面
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date questionTime; //提问时间
    private Boolean isPublic; //是否匿名
    private int replynum; //回复数
    private int thumbsupnum;//顶数
    private int viewnum;  //点击/阅读数
    private int state = STATE_WAITING;//问答状态
    private QuestionAndAnswerContent questionAndAnswerContent;//内容
    private QuestionAndAnswerComment comment;//评论


    public String getQAndAStateDisplay(){
        if (state ==STATE_WAITING ){
            return "待发布";
        }else if(state ==STATE_ANSWERED ){
            return "已回答";
        }else if(state ==STATE_UNANSWERED ){
            return "未回答";
        }
        return "";
    }

}
